/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bean.session;

import entity.RefundRequestEntity;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import type.RefundRequestStatus;

/**
 *
 * @author wei
 */
@Stateless
public class RefundRequestEntityFacade extends AbstractFacade<RefundRequestEntity> {
    @PersistenceContext(unitName = "MacTeam-warPU")
    private EntityManager em;

    protected EntityManager getEntityManager() {
        return em;
    }

    public RefundRequestEntityFacade() {
        super(RefundRequestEntity.class);
    }
    
    public List<RefundRequestEntity> getUnprocessedRefundRequests(){
        
        Query query = em.createQuery("SELECT s FROM RefundRequest s "
                + " WHERE s.archived != 'true' AND s.status=:statusPending ");
        query.setParameter("statusPending", RefundRequestStatus.pending);
//        query.setParameter("statusApproved", RefundRequestStatus.approved);

        return query.getResultList();
    }
    
}
